package ex02.pyrmont;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

import f.h.dragon.jlog.Logger;

/**
 * PrimitiveServlet: test servlet
 *
 * @author Wenlong Meng(wenlong.meng@gmail.com)
 * @version 1.0 at 2012/03/13
 * @since 1.0
 */
public class PrimitiveServlet implements Servlet {
	
	//local variables
	/**
	 * logger
	 */
	private static Logger logger = Logger.getLogger(PrimitiveServlet.class);

	/* (non-Javadoc)
	 * @see javax.servlet.Servlet#destroy()
	 */
	@Override
	public void destroy() {
		logger.debug("exec: destroy()...");
	}

	/* (non-Javadoc)
	 * @see javax.servlet.Servlet#getServletConfig()
	 */
	@Override
	public ServletConfig getServletConfig() {
		return null;
	}

	/* (non-Javadoc)
	 * @see javax.servlet.Servlet#getServletInfo()
	 */
	@Override
	public String getServletInfo() {
		return null;
	}

	/* (non-Javadoc)
	 * @see javax.servlet.Servlet#init(javax.servlet.ServletConfig)
	 */
	@Override
	public void init(ServletConfig arg0) throws ServletException {
		logger.debug("exec:init(" + arg0 + ")...");
	}

	/* (non-Javadoc)
	 * @see javax.servlet.Servlet#service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
	 */
	@Override
	public void service(ServletRequest req, ServletResponse res)
			throws ServletException, IOException {
		logger.debug("Begin: service(" + req + ", " + res + ")...");
		PrintWriter out = res.getWriter();
		out.print("做想做的事之前，做不得不做的事.");
		out.println("  —— F.H Dragon");
		out.println("");
		logger.debug("End: service!");
	}

}
